package bombercloud;

import java.io.IOException;
import java.util.Properties;

/**
 *
 * @author Leonardo Oliveira Moreira
 */
public class BomberCloudNodeConfig {

    public static final String DATABASE_DRIVER = getConfigurationValue("database.driver");
    public static final String DATABASE_URL = getConfigurationValue("database.url");
    public static final String DATABASE_USERNAME = getConfigurationValue("database.username");
    public static final String DATABASE_PASSWORD = getConfigurationValue("database.password");

    private BomberCloudNodeConfig() {

    }

    /**
     *
     * @param key
     * @return
     */
    private static String getConfigurationValue(String key) {
        String value = "";
        Properties properties = new Properties();
        try {
            properties.load(BomberCloudNodeConfig.class.getResourceAsStream("configuration.properties"));
            value = properties.getProperty(key);
            if (value == null || value.trim().length() == 0) {
                return "";
            }
        } catch (IOException ex) {
            return "";
        }
        return value;
    }
}
